package cn.jbolt.core.render;

import com.jfinal.render.Render;
import com.jfinal.render.RenderFactory;

import javax.servlet.http.HttpServletResponse;
/**
 * 定制JBolt的自定义renderFactory
 * @ClassName:  JBoltRenderFactory
 * @author: JFinal学院-小木 QQ：909854136
 * @date:   2022年3月16日
 */
public class JBoltRenderFactory extends RenderFactory {
	@Override
	public Render getErrorRender(int errorCode) {
		switch (errorCode) {
			case HttpServletResponse.SC_NOT_FOUND:
				return getJBoltErrorRender(errorCode);
			case HttpServletResponse.SC_INTERNAL_SERVER_ERROR:
				return getJBoltErrorRender(errorCode);
			case HttpServletResponse.SC_UNAUTHORIZED:
				return getJBoltErrorRender(errorCode);
			case HttpServletResponse.SC_FORBIDDEN:
				return getJBoltErrorRender(errorCode);
			default:
				break;
		}
		return super.getErrorRender(errorCode);
	}

	private Render getJBoltErrorRender(int errorCode) {
		return new JBoltErrorRender(errorCode);
	}
}
